Syntax10.Scn.Fnt ParcElems Alloc Syntax24b.Scn.Fnt Syntax10b.Scn.Fnt FoldElems (* AMIGA *) MODULE AmigaSystem; (* RD 15-06-96 *) IMPORT Texts, Oberon, Amiga; W: Texts.Writer; PROCEDURE Str(s: ARRAY OF CHAR); BEGIN Texts.WriteString(W, s) END Str; PROCEDURE Ch(ch: CHAR); BEGIN Texts.Write(W, ch) END Ch; PROCEDURE Integer(i: LONGINT); BEGIN Texts.Write(W, " "); Texts.WriteInt(W, i, 0) END Integer; PROCEDURE Ln; BEGIN Texts.WriteLn(W) END Ln; PROCEDURE Append(t: Texts.Text); BEGIN ASSERT(t#NIL); Texts.Append(t, W.buf) END Append; PROCEDURE ScanFirst(VAR s: Texts.Scanner); (* Scan first parameter *) VAR sel: Texts.Text; beg, end, time: LONGINT; BEGIN Texts.OpenScanner(s, Oberon.Par.text, Oberon.Par.pos); Texts.Scan(s); IF (s.class = Texts.Char) & (s.c = "^") OR (s.line # 0) THEN Oberon.GetSelection(sel, beg, end, time); IF time >= 0 THEN Texts.OpenScanner(s, sel, beg); Texts.Scan(s) END END ScanFirst; (* Set the time to wait between two runs of the main loop. If 0, main loop runs allways at low pri *) PROCEDURE SetInterval*; VAR s: Texts.Scanner; BEGIN ScanFirst(s); IF (s.class=Texts.Int) & (s.i>=0) & (s.i<1000) THEN Amiga.TicsToWait:=1000*s.i END SetInterval; PROCEDURE ShowMode*; displayID:LONGINT; height, width, depth: INTEGER; oscan:LONGINT; autoScroll, WBWindow, PrivateColors:BOOLEAN; BEGIN Amiga.ReadScreenMode(displayID, height, width, depth, oscan, autoScroll, WBWindow, PrivateColors); Str("Width "); Integer(width); Ln; Str("Height "); Integer(height); Ln; Str("Depth "); Integer(depth); Ln; Str("AutoScroll "); IF autoScroll THEN Str("TRUE") ELSE Str("FALSE") END; Ln; Append(Oberon.Log) END ShowMode; PROCEDURE ChangeMode*; res: INTEGER; s: Texts.Scanner; displayID:LONGINT; height, width, depth: INTEGER; oscan:LONGINT; autoScroll, WBWindow, PrivateColors: BOOLEAN; PROCEDURE GetInt(VAR val: INTEGER; min, max: INTEGER); BEGIN Texts.Scan(s); IF (s.class = Texts.Int) & (min <= s.i) & (s.i <= max) THEN val := SHORT(s.i) END; Texts.Scan(s) END GetInt; BEGIN Amiga.ChangeMode(res); IF res#0 THEN Amiga.ReadScreenMode(displayID, height, width, depth, oscan, autoScroll, WBWindow, PrivateColors); ScanFirst(s); WHILE s.class = Texts.Name DO IF s.s = "Width" THEN GetInt(width, 320, 16383) ELSIF s.s = "Height" THEN GetInt(height, 200, 16383) ELSIF s.s = "Depth" THEN GetInt(depth, 1, 8) ELSIF s.s = "AutoScroll" THEN Texts.Scan(s); IF s.class = Texts.Name THEN IF s.s = "TRUE" THEN autoScroll := TRUE; Texts.Scan(s) ELSIF s.s = "FALSE" THEN autoScroll := FALSE; Texts.Scan(s) END END ELSE Texts.Scan(s) END END; Amiga.WriteScreenMode(displayID, height, width, depth, oscan, autoScroll, WBWindow, PrivateColors); Str("changes take effect after restart!"); Ln; Append(Oberon.Log) END ChangeMode; PROCEDURE ChangePri*; VAR s: Texts.Scanner; PROCEDURE GetInt(VAR val: SHORTINT; min, max: SHORTINT); BEGIN IF (s.class = Texts.Int) & (min <= s.i) & (s.i <= max) THEN val := SHORT(SHORT(s.i)) END; Texts.Scan(s) END GetInt; BEGIN ScanFirst(s); GetInt(Amiga.idlePri, -128, -31); GetInt(Amiga.normalPri, Amiga.idlePri, 5); Str("System.ChangePri idle normal ="); Integer(Amiga.idlePri); Integer(Amiga.normalPri); Ln; Append(Oberon.Log); Amiga.Turbo END ChangePri; PROCEDURE TwoButtonMouse*; BEGIN Amiga.useLAltAsMouse:=TRUE END TwoButtonMouse; PROCEDURE ThreeButtonMouse*; BEGIN Amiga.useLAltAsMouse:=FALSE END ThreeButtonMouse; PROCEDURE UseQuitRequester*; BEGIN Amiga.UseQuitRequester:=TRUE END UseQuitRequester; PROCEDURE PictPrintThresh*; VAR s: Texts.Scanner; PROCEDURE GetInt(VAR val: INTEGER; min, max: INTEGER); BEGIN IF (s.class = Texts.Int) & (min <= s.i) & (s.i <= max) THEN val := SHORT(s.i) END; Texts.Scan(s) END GetInt; BEGIN ScanFirst(s); GetInt(Amiga.PictPrintThresh, 0, 255) END PictPrintThresh; PROCEDURE PrinterName*; VAR S: Texts.Scanner; (* get parameters from Menu, Text or Selection *) PROCEDURE GetPar(VAR S: Texts.Scanner): BOOLEAN; VAR text: Texts.Text; beg, end, time: LONGINT; BEGIN Texts.OpenScanner(S, Oberon.Par.text, Oberon.Par.pos); Texts.Scan(S); IF S.class=Texts.Char THEN IF S.c="^" THEN Oberon.GetSelection(text, beg, end, time); IF time=-1 THEN RETURN FALSE END; Texts.OpenScanner(S, text, beg); Texts.Scan(S) END END; RETURN TRUE END GetPar; BEGIN IF GetPar(S) THEN IF (S.class=Texts.Name) OR (S.class=Texts.String) THEN COPY(S.s, Amiga.PrinterName) END END; Str("Printer Name: "); Str(Amiga.PrinterName); Ln; Append(Oberon.Log) END PrinterName; BEGIN Texts.OpenWriter(W) END AmigaSystem.